package co.sanduche.behave.mmos;

import co.sanduche.models.Models;
import co.sanduche.models.Models.User;
import co.sanduche.services.EndPoints.UserEP;
import co.sanduche.util.DepVal0;
import co.sanduche.util.EPCallback;
import co.sanduche.vos.LoginCredentials;

public class AuthenticationMMO {

	private DepVal0<User> user = new DepVal0<User>() {

		@Override
		public void asyncGetter() {
			UserEP.getMyInfo(new EPCallback<Models.User>() {

				@Override
				public void onSuccess(User arg0) {
					// TODO Auto-generated method stub
					ready(arg0);

				}

				@Override
				public void onFailure(Throwable e) {
					// TODO Auto-generated method stub
					failed(e);
				}
			});
		}
	};

	public void login(LoginCredentials credentials,
			final EPCallback<Void> epCallback) {
		UserEP.login(credentials, epCallback);

	}

	public void getUserInfo(EPCallback<User> epCallback) {
		user.onReady(epCallback);
	}

}
